package com.bookstore.back.entity;

import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * 畅销榜单实体类
 * 
 * @author 程序猿_Ti
 * @since 2025-07-23
 */
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("bestseller")
public class Bestseller implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 榜单ID
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    /**
     * 图书ID
     */
    @TableField("book_id")
    private Integer bookId;

    /**
     * 分类ID，0表示综合榜
     */
    @TableField("category_id")
    private Integer categoryId;

    /**
     * 排名
     */
    @TableField("rank")
    private Integer rank;

    /**
     * 统计周期：daily-日榜 weekly-周榜 monthly-月榜
     */
    @TableField("period")
    private String period;

    /**
     * 创建时间
     */
    @TableField(value = "created_at", fill = FieldFill.INSERT)
    private LocalDateTime createdAt;

    /**
     * 更新时间
     */
    @TableField(value = "updated_at", fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updatedAt;

    /**
     * 关联的图书信息（非数据库字段）
     */
    @TableField(exist = false)
    private Book book;

}
